projects
/
xen.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
d962772
)
minios: add trydown
author
Keir Fraser
<keir.fraser@citrix.com>
Thu, 17 Jan 2008 14:40:55 +0000
(14:40 +0000)
committer
Keir Fraser
<keir.fraser@citrix.com>
Thu, 17 Jan 2008 14:40:55 +0000
(14:40 +0000)
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
extras/mini-os/include/semaphore.h
patch
|
blob
|
history
diff --git
a/extras/mini-os/include/semaphore.h
b/extras/mini-os/include/semaphore.h
index 261cd7e5dabf5e7351c27eb063e73d26be2a0cee..19f515a1f162a29b22cd8699e56bc85db1bbcf04 100644
(file)
--- a/
extras/mini-os/include/semaphore.h
+++ b/
extras/mini-os/include/semaphore.h
@@
-49,6
+49,19
@@
static inline void init_SEMAPHORE(struct semaphore *sem, int count)
#define init_MUTEX(sem) init_SEMAPHORE(sem, 1)
+static inline int trydown(struct semaphore *sem)
+{
+ unsigned long flags;
+ int ret = 0;
+ local_irq_save(flags);
+ if (sem->count > 0) {
+ ret = 1;
+ sem->count--;
+ }
+ local_irq_restore(flags);
+ return ret;
+}
+
static void inline down(struct semaphore *sem)
{
unsigned long flags;